using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Tools;
using Pixysoft.Framework.Verifications;
using Pixysoft.Framework.Noebe;
using Pixysoft.Weblications.Sango.Entities;

namespace Pixysoft.Weblications.Sango.Environment
{
    public class EqmGradeHelper
    {
        private static List<Eqm_Grade> orms = new List<Eqm_Grade>();

        public static void initialize()
        {
            orms = SettingHelper.GetNoebe().EntityNoebeCommand.Select<Eqm_Grade>();

            LoggerHelper.Info("initialize Eqm_Grade.countin {0}", orms.Count);
        }

        public static List<Eqm_Grade> searchAll()
        {
            return orms;
        }

        public static Eqm_Grade search(long eqmTypeCode, long gradeTypeCode)
        {
            foreach (Eqm_Grade orm in orms)
            {
                if (orm.Gradetypecode != gradeTypeCode)
                    continue;

                if (orm.Equipmenttypecode != eqmTypeCode)
                    continue;

                return orm;
            }

            throw Exceptions.VerificationFailedException(eqmTypeCode, gradeTypeCode);
        }
    }
}